import PQ from './index'

interface I {age: number, money: number}
export const test = () => {
    class A {
        age = 10
        money = 100
    }

    class B {
        age = 12
        money = 5000
    }

    class C {
        age = 13
        money = 600
    }

    const pq = new PQ<I>([new A, new B, new C], (a, b) => a.money -  b.money)
    // print(pq as any)
    
    // console.log(pq.front())
    // console.log(pq.deQueue())
    // console.log(pq.front())
    print(pq)
}

/**
 * 打印堆
 * @param h 
 */
const print = (h: PQ<I>) => {
    let str = ''
    h.forEach((ele: any, i) => {
        str += ele?.age + ' '
    })
    console.log(str)
}
